Here we encounter the general checks and variables required before we get
into the script proper.
1parse arg cmd ' ' portname ' "' arcfile '" ' handle ' ' arcsubdir
2
3address value portname
4options results
5options failat 21
6signal on syntax
7signal on halt
8signal on break_c
9lf = '0a'x
10
11dopus getfiletype '"'arcfile'"' id
12arctype = result
13if arctype ~= 'LHA' & arctype ~= 'LZX' then
14 exit
15
16if ~show('l','rexxsupport.library') then
17 call addlib('rexxsupport.library',0,-30)
18
19if exists('LIBS:locale.library') then do
20 if ~show(l,'locale.library') then
21 call addlib('locale.library',0,-30)
22 catalog = opencatalog('ArcDir.catalog','english',0)
23 end
24else
25 catalog = 0
26
27dopus version
28newopus = result ~= 'RESULT' & translate(result,'.',' ') >= 5.1215
29
30if upper(cmd) = 'BROWSE' | handle = 0 then do
31 lister new
32 handle = result
33 lister set handle source
34 end
35else
36 lister empty handle
37
38call arclist
Line:
1 We parse in the arguments it was called with, the command (BROWSE or
GETDIR), the Opus portname (DOPUS.1 assumed), name of the file, the
lister handle and the sub-directory in the archive. The last is
used when ArcDir is called from within an ArcDir lister to open a new
lister with a sub-directory from the first. Make sense? It's when
you shift-doubleclick on a directory within an ArcDir lister.
3 Address the port, DOPUS.1
4 Enable results, the RESULT variable.
5 Set the fail limit.
6 - 8 Jump to syntax, halt and break_c when any of those errors happen.
9 Set lf to equal ASCII code 10, a linefeed.
11 - 14 First Opus command, we get the Filetype ID of the file the script was
called with, and assign the variable arctype to it. If the ID wasn't
LHA or LZX, (the two types of archives ArcDir deals with), then we
exit.
16 - 25 Load the rexxsupport.library if not already, load locale.library if
it exists and not loaded already. Then try to open the correct
ArcDir catalog file, set catalog to true if successful, false if not.
27 - 28 What version of Opus are we dealing with? If it's 5.1215 or later,
then newopus is set to true.
30 - 36 What command did we call ArcDir with? If it was BROWSE then open a
new lister, store it's handle and set it to SOURCE. If not,
(GETDIR), then display an empty cache in the current lister, if there
aren't any, we'll just clear the current one.
38 Call the routine which lists the archive in the lister.
|